#ifndef PKG_HEADER
#define PKG_HEADER

//misc functions
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//cryptopp files
#include "cryptopp/queue.h"
#include "cryptopp/files.h"
#include "cryptopp/rsa.h"
#include "cryptopp/base64.h"
#include "cryptopp/cryptlib.h"
#include "cryptopp/sha.h"
#include "cryptopp/hmac.h"

//exceptions
#include <stdexcept>

#include "PubPri_Files.h"


//http://www.cryptopp.com/fom-serve/cache/83.html
//http://www.cryptopp.com/wiki/RSA
//http://www.cryptopp.com/wiki/Keys_and_Formats#Private_Key_Format

#define byte unsigned char

struct PubPriPair
{
  std::string publicFile;
  std::string privateFile;
};

class KDF2_RNG:public CryptoPP::RandomNumberGenerator
{
  private:
  CryptoPP::word32 m_counter;
  CryptoPP::SecByteBlock m_counterAndSeed;
  
  public:
  KDF2_RNG(const byte *seed, size_t seedSize);;
 
  void GenerateBlock(byte *output, size_t size);
};

class PKG
{
private:
  byte *masterKey;
  byte *IdentifyDigestFunction(byte *ID);

public:
  PKG(byte *mKey);
  PubPriPair *GenerateKeyPair(byte *ID);
};

#endif
